<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui穿梭树组件</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../js/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../../css/public.css" media="all" />
</head>
<body class="childrenBody">
    <form class="layui-form">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
            <legend>自定义：穿梭树窗口</legend>
        </fieldset>
        <button type="button" class="layui-btn layui-btn-sm" lay-submit lay-filter="openShuttleTree">打开穿梭树</button>
        <button type="button" class="layui-btn layui-btn-sm" lay-submit lay-filter="openShuttleTreeWindow">打开穿梭树窗口</button>
        <hr>
        <div id="test1"></div>
    </form>
    <script type="text/javascript" src="../../js/layui/layui.js"></script>
    <script type="text/javascript" src="../../js/public.js"></script>
    <script type="text/javascript" src="../component/shuttleTree/shuttleTree.js"></script>
    <script type="text/javascript">
        layui.use(['form','layer','transfer'], function() {
            var $ = layui.jquery
                , layer = parent.layer
                , form = layui.form
                , transfer = layui.transfer;

            form.on('submit(openShuttleTree)', function(data){
                // 穿梭树渲染
                transfer.render({
                    elem: '#test1'  // 绑定元素
                    ,data: [
                        {"value": "1", "title": "李白", "disabled": "", "checked": ""}
                        ,{"value": "2", "title": "杜甫", "disabled": "", "checked": ""}
                        ,{"value": "3", "title": "贤心", "disabled": "", "checked": ""}
                    ]
                    ,id: 'demo1' // 定义索引
                });
                return false;
            });

            form.on('submit(openShuttleTreeWindow)', function (data) {
                ShuttleTree.open();
                return false;
            })
        });
    </script>
</body>
</html>